import { reactive } from 'vue'
const formData = {
  name: {
    label: '电影名称',
    rule: [{ required: true }]
  },
  star: {
    label: '主演',
    ellipsis: true
  },
  url: {
    label: '影片地址',
    ellipsis: true
  },
  cover: {
    label: '封面',
    ellipsis: true
  },
  typeId: {
    label: '类型',
    isSelect: true,
    options: []
  },
  areaId: {
    label: '地区',
    isSelect: true,
    options: []
  },
  time: {
    label: '时长(分钟)',
    placeholder: '分钟'
  },
  playTime: {
    label: '上映日期',
    isDate: true
  },
  desc: {
    label: '简介',
    ellipsis: true,
    isTextarea: true
  }
}
export function getFormData () {
  return reactive(formData)
}
export function getRule () {
  const rule = {}
  for (const key in formData) {
    if (formData[key].rule) {
      rule[key] = formData[key].rule
    }
  }
  return rule
}
export function getCols () {
  const cols = []
  for (const key in formData) {
    cols.push({
      colKey: key,
      title: formData[key].label,
      ellipsis: formData[key].ellipsis
    })
  }
  return reactive(cols)
}
